package main

import (
	"StorageServer/final/dataServer/heartbeat"
	"StorageServer/final/dataServer/locate"
	"StorageServer/final/dataServer/objects"
	"StorageServer/final/dataServer/temp"
	"log"
	"net/http"
	"os"
)

func main() {
	locate.CollectObjects()
	go heartbeat.StartHeartbeat() //启动心跳机制
	go locate.StartLocate()       //决定当前文件将在哪台服务器节点上执行操作
	http.HandleFunc("/objects/", objects.Handler)
	http.HandleFunc("/temp/", temp.Handler)
	log.Fatal(http.ListenAndServe(os.Getenv("LISTEN_ADDRESS"), nil))
}
